/*
 * @Author: czy
 * @Date: 2021-07-09 13:57:25
 * @LastEditTime: 2021-07-14 20:32:25
 */

#define outb(port, value) __asm__ __volatile__("outb %b0,%w1" ::"a"(value), "Nd"(port));

/**
 * @description: Initialization PIT.
 */
void init8253(void)
{
    outb(0x43, 0x43);
    outb(0x40, 0x9b);
    outb(0x40, 0x2e);
}

/**
 * @description: Initialization PIC.
 */
void init8259(void)
{
    outb(0x20, 0x11);
    outb(0x21, 0x20);
    outb(0x21, 0x04);
    outb(0x21, 0x3);
}

/**
 * @description: Initialization.
 */
void interrupt_init(void)
{
    init8253();
    init8259();
}